import commonID from '@/utils/commonID'
import { get, post } from './api'

export function alterPersonInfo(user) {
    return post('alterPersonInfo', user)
};


export function alterPasswordByOldPwd(role, uid, oldPassword, newPassword) {
    return post('alterPassword', {
        role,
        [commonID(role)]: uid,
        oldPassword, newPassword
    })
}
export function setSecretQuestion(role, uid, question, answer) {
    return post('setSecretQuestion', { role, [commonID(role)]: uid, question, answer })
}
// 获取密保问题
export function getSecretQuestion(role, uid) {

    return get('getSecretQuestion', { role, [commonID(role)]: uid })
}
// 提交密保答案
export function submitSecretAnswer(role, uid, answer) {

    return post('submitSecretAnswer', { role, [commonID(role)]: uid, answer })
}
// 修改新密码alterPassword
export function alterPasswordBySecretQuestion(role, uid, password) {

    return post('alterPassword', { role, [commonID(role)]: uid, password })
}

// 查看期班
export function getClassList() {
    return get('getPeriodClass')
}

// 获取期或者班
export function getPeriodOrClass(grade_id) {
    return grade_id ? get('getPeriodClassOrGrade', { grade_id }) : get('getPeriodClassOrGrade')
}